<?php

function fixObject(&$object) {
    if (!is_object($object) && gettype($object) == 'object')
        return ($object = unserialize(serialize($object)));
    return $object;
}

$Point = 0;
if(isset ($_SESSION["Point"]))
    $Point = $_SESSION["Point"];

    

$idWordUser = $_REQUEST['id'];
$ThreeWord = $_SESSION["ThreeWord"];
$rightWord = new Word();
$rightWord = $ThreeWord[0];
fixObject($rightWord);

$RightWords =  $_SESSION["RightWords"];
$VirtualWord = $_SESSION["VirtualWord"];

$tempThreeWords = $_SESSION["tempThreeWords"];

?>

<table>
    <tr>
        <?php
        for ($i = 0; $i < 3; ++$i) {
            $tempWord = new Word();
            $tempWord = $tempThreeWords[$i];
            fixObject($tempWord);

            if ($idWordUser == $rightWord->id && $tempWord->id == $idWordUser) {
                $_SESSION["Point"] = ++$Point;
                ?>
                <td style="width: 250px;"> 
                    <div  class="picture_box" style="border: 2px solid blue;"><a href="#" onclick='ClickPicture(<?php echo $tempWord->id; ?>);' ><img id="new_word" src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/<?php echo $tempWord->picture; ?>" alt="new world"/>
                            <p><?php echo $tempWord->vietName; ?></p></a>
                    </div>
                </td>

                <?php
            } else {
                if ($tempWord->id == $idWordUser) {
                    ?>
                    <td style="width: 250px;"> 
                        <div  class="picture_box" style="border: 2px solid red;"><a href="#" onclick='ClickPicture(<?php echo $tempWord->id; ?>);' ><img id="new_word" src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/<?php echo $tempWord->picture; ?>" alt="new world"/>
                                <p><?php echo $tempWord->vietName; ?></p></a>
                        </div>
                    </td>

                    <?php
                } else {
                    if ($tempWord->id == $rightWord->id) {
                        ?>
                        <td style="width: 250px;"> 
                            <div class="picture_box" style="border: 2px solid blue;"><a href="#" onclick='ClickPicture(<?php echo $tempWord->id; ?>);' ><img id="new_word" src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/<?php echo $tempWord->picture; ?>" alt="new world"/>
                                    <p><?php echo $tempWord->vietName; ?></p></a>
                            </div>
                        </td>

                <?php
            } else {
                ?>
                        <td style="width: 250px;"> 
                            <div  class="picture_box" ><a href="#" onclick='ClickPicture(<?php echo $tempWord->id; ?>);' ><img id="new_word" src="<?php echo elgg_get_site_url(); ?>mod/MyCourse/<?php echo $tempWord->picture; ?>" alt="new world"/>
                                    <p><?php echo $tempWord->vietName; ?></p></a>
                            </div>
                        </td>
                <?php
            }
        }
    }
}

?>
    </tr>
</table>

